how to calculate profit and loss in c language